//
//  FuturesCell.m
//  Futures
//
//  Created by Cheng on 2017/6/21.
//  Copyright © 2017年 Cheng. All rights reserved.
//

#import "FuturesCell.h"

@implementation FuturesCell

- (void)awakeFromNib {
    [super awakeFromNib];

    ViewRadius(self.imageButton, self.imageButton.frame.size.height/2);
    ViewBorder(self.imageButton, UICOLOR_RGB_Alpha(0xf6f6f6, 1), 1.0);
//    self.imageButton.titleLabel.font = FontSet(12);
}

- (void)setCellWithModel:(QuoteModel *)model{
    [self.imageButton setTitle:model.Symbol forState:UIControlStateNormal];
    self.title.text = model.Symbolname;
    self.price.text = [NSString stringWithFormat:@"%.2f",model.LastPrice];
    
//    double raisePercent = (model.LastPrice - model.open)/model.open*100;
    
    self.raisePercent.text = [NSString stringWithFormat:@"%.2f%%",model.ChangeRate];
    
    
    
//    if (raisePercent == 0) {
//        self.price.textColor = [UIColor blackColor];
//        self.raisePercent.textColor = [UIColor blackColor];
//    }else
        if (model.ChangeRate < 0){
        self.price.textColor = [UIColor greenColor];
        self.raisePercent.textColor = [UIColor greenColor];
    }
    
//    if (model.open == 0){
//        self.raisePercent.text = @"0.00%";
//    }
}

@end
